package com.linxianqin.springbootVue.domain.convert;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.linxianqin.springbootVue.domain.dto.SysUserDTO;
import com.linxianqin.springbootVue.domain.entity.SysUser;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 功能描述：SysUser转化接口
 * @author lxq
 * @version 1.00
 * @Date 2020/12/13
 */
@Mapper
public interface SysUserConvert {
    SysUserConvert INSTANCE = Mappers.getMapper(SysUserConvert.class);

    SysUserDTO entity2dto(SysUser sysUser);


    SysUser dto2entity(SysUserDTO dto);

    @Mappings({
            @Mapping(target = "ascs",ignore = true),
            @Mapping(target = "asc",ignore = true),
            @Mapping(target = "descs",ignore = true),
            @Mapping(target = "desc",ignore = true),
    })
    Page<SysUserDTO>entity2dto(Page<SysUser> page);
    @Mappings({
            @Mapping(target = "ascs",ignore = true),
            @Mapping(target = "asc",ignore = true),
            @Mapping(target = "descs",ignore = true),
            @Mapping(target = "desc",ignore = true),
    })
    Page<SysUser> dto2entity(Page<SysUserDTO> page);
    List<SysUser> dto2entity(List<SysUserDTO> userDTOList);
    List<SysUserDTO> entity2dto(List<SysUser> sysUser);
}
